﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BusinessLayer;

namespace PresentationLayer
{
    public partial class CriarDepartamento : Form
    {
        public CriarDepartamento()
        {
            InitializeComponent();
        }

        private void Criar_Click(object sender, EventArgs e)
        {
            this.textCodDep.SelectAll();
            this.textOfic.SelectAll();
            this.textBoxDescricao.SelectAll();
            String dep, ofic, desc;
            if ((dep = this.textCodDep.SelectedText) == " " ||
                (ofic = this.textOfic.SelectedText) == " " ||
                (desc = this.textBoxDescricao.SelectedText) == " ")
            {
                MessageBox.Show("Todos os dados são obrigatórios");
                return;
            }

            if (DepartamentoActions.CriarDep(dep, ofic, desc))
                this.Close();
        }
    }
}
